extends Area2D

var player_in_range:bool=false

func _ready() -> void:
	sprite.play("5")

func _on_body_entered(body) -> void:
	if body.name =="player":
		player_in_range=true

func _on_body_exited(body) -> void:
	if body.name =="player":
		player_in_range=false
		

@onready var sprite = $"../AnimatedSprite2D"
var count = 5
func _input(event):
	if event.is_action_pressed("pick_up") and player_in_range and GameUtiles.move_allow:
		if count >= 1:
			count -= 1
			GameUtiles.add_item("big_leaf")
			sprite.play(str(count))
